package net.tv90.volunteerserveradmin.manager.factory;


import net.tv90.volunteerserveradmin.model.domain.OperationLog;
import net.tv90.volunteerserveradmin.service.OperationLogService;
import net.tv90.volunteerserveradmin.utils.SpringUtils;

import java.util.TimerTask;

/**
 * 异步工厂（产生任务用）
 */
public class AsyncFactory {

    /**
     * 记录操作日志
     *
     * @param operationLog 操作日志信息
     * @return 任务task
     */
    public static TimerTask recordOperation(OperationLog operationLog) {
        return new TimerTask() {
            @Override
            public void run() {
                SpringUtils.getBean(OperationLogService.class).saveOperationLog(operationLog);
            }
        };
    }

}